-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Chats - Selected chat is hidden when navigating via keyboard #51754
Conversation
@rayane-djouah Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-11-05.at.7.59.43.PM.movAndroid: mWeb ChromeScreen.Recording.2024-11-05.at.7.54.44.PM.moviOS: NativeSimulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2024-11-05.at.20.29.58.mp4iOS: mWeb SafariSimulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2024-11-05.at.19.21.57.mp4MacOS: Chrome / SafariScreen.Recording.2024-11-05.at.6.58.51.PM.movMacOS: DesktopScreen.Recording.2024-11-05.at.7.03.15.PM.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of passing searchType
to BaseSelectionList
, consider passing a shouldKeepFocusedItemAtTopOfViewableArea
boolean prop. This would make the solution reusable and help keep BaseSelectionList
more abstract.
src/components/Search/index.tsx
Outdated
@@ -466,6 +466,7 @@ function Search({queryJSON, onSearchListScroll, contentContainerStyle}: SearchPr | |||
} | |||
contentContainerStyle={[contentContainerStyle, styles.pb3]} | |||
scrollEventThrottle={1} | |||
searchType={type} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
searchType={type} | |
shouldKeepFocusedItemAtTopOfViewableArea={type === CONST.SEARCH.DATA_TYPES.CHAT} |
@@ -107,6 +107,7 @@ function BaseSelectionList<TItem extends ListItem>( | |||
scrollEventThrottle, | |||
contentContainerStyle, | |||
shouldHighlightSelectedItem = false, | |||
searchType = '', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
searchType = '', | |
shouldKeepFocusedItemAtTopOfViewableArea = false, |
// Since there are always two items above the focused item in viewable area, and items can grow beyond the screen size | ||
// in searchType chat, the focused item may move out of view. To prevent this, we will ensure that the focused item remains at | ||
// the top of the viewable area at all times by adjusting the viewOffset. | ||
if (searchType === 'chat') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (searchType === 'chat') { | |
if (shouldKeepFocusedItemAtTopOfViewableArea) { |
Let's also adjust the comment
Yup, that's a good idea 👍 |
…TopOfViewableArea` instead of `searchType`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM and tests well 👍
@tushar-a-b Let's clarify the QA tests (Add expected behaviour):
|
Yes, Thanks! @rayane-djouah |
@marcochavezf all yours! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, Thanks!
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/marcochavezf in version: 9.0.59-0 🚀
|
🚀 Deployed to production by https://github.com/francoisl in version: 9.0.59-3 🚀
|
Explanation of Change
This PR addresses an issue where focused chat moves out of view in search chats section.
Fixed Issues
$ #48902
PROPOSAL: #48902 (comment)
Tests
Precondition:
Steps:
Offline tests
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
web.mp4
MacOS: Desktop
desktop.mp4